import com.google.jplurk.*

words = ['karma']

words.each {
	word ->
	
	if (plurk.content.toLowerCase().indexOf(word) >= 0) {
		println "match ${word}"
		
		other = plurk.content.toLowerCase().replace(word, '').trim()

		if (!other.equals('')) {
			
			users = ship.client.searchUser(other).users
			
			if (users.length() > 0) {
			
				msgs = []
				for (def i=0; i<users.length(); i++) {
					user = users.get(i)
					msgs << "${user.nick_name}(${user.karma})"
				}
				
				if (msgs) {
					matched++
					ship.response plurk.plurk_id, msgs.join(', '), Qualifier.THINKS
				}

			}
			else {
				matched++
				ship.response plurk.plurk_id, "${other} not exists", Qualifier.SAYS
			}
		}
		else {
			karma = ship.client.ownProfile.user_info.karma
			matched++
			ship.response plurk.plurk_id, "${karma}", Qualifier.SAYS
		}
	}
}
